﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace iNet.Win32
{
	/// <summary>
	/// 提供 User32.dll 的 Windows API 函式。
	/// </summary>
	public static unsafe class User32
	{
		#region FindWindow
		[DllImport("User32", SetLastError = true)]
		public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
		#endregion
		#region FlashWindow
		[DllImport("User32", SetLastError = true)]
		public static extern bool FlashWindow(IntPtr hWnd, bool bInvert);
		#endregion
		#region FlashWindowEx
		[DllImport("User32", SetLastError = true)]
		public static extern bool FlashWindowEx(ref FLASHWINFO pfwi);
		#endregion
		#region GetDoubleClickTime
		[DllImport("User32")]
		public static extern int GetDoubleClickTime();
		#endregion
		#region GetMonitorInfo
		[DllImport("User32")]
		public static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);
		[DllImport("User32")]
		public static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFOEX lpmi);
		#endregion
		#region GetWindowLong
		[DllImport("User32", SetLastError = true)]
		public static extern int GetWindowLong(IntPtr hWnd, GWL nIndex);
		#endregion
		#region MonitorFromWindow
		[DllImport("User32")]
		public static extern IntPtr MonitorFromWindow(IntPtr hwnd, MONITOR dwFlags);
		#endregion
		#region PostMessage
		[DllImport("User32", SetLastError = true)]
		public static extern bool PostMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
		[DllImport("User32", SetLastError = true)]
		public static extern bool PostMessage(IntPtr hWnd, int Msg, IntPtr wParam, string lParam);
		[DllImport("User32", SetLastError = true)]
		public static extern bool PostMessage(IntPtr hWnd, int Msg, IntPtr wParam, void* lParam);
		#endregion
		#region PostThreadMessage
		[DllImport("User32", SetLastError = true)]
		public static extern bool PostThreadMessage(int idThread, int Msg, IntPtr wParam, IntPtr lParam);
		[DllImport("User32", SetLastError = true)]
		public static extern bool PostThreadMessage(int idThread, int Msg, IntPtr wParam, string lParam);
		[DllImport("User32", SetLastError = true)]
		public static extern bool PostThreadMessage(int idThread, int Msg, IntPtr wParam, void* lParam);
		#endregion
		#region RegisterDeviceNotification
		[DllImport("User32", SetLastError = true)]
		public static extern IntPtr RegisterDeviceNotification(IntPtr hRecipient, ref DEV_BROADCAST_DEVICEINTERFACE NotificationFilter, DEVICE_NOTIFY Flags);
		[DllImport("User32", SetLastError = true)]
		public static extern IntPtr RegisterDeviceNotification(IntPtr hRecipient, ref DEV_BROADCAST_HANDLE NotificationFilter, DEVICE_NOTIFY Flags);
		#endregion
		#region SendMessage
		[DllImport("User32", SetLastError = true)]
		public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
		[DllImport("User32", SetLastError = true)]
		public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, string lParam);
		[DllImport("User32", SetLastError = true)]
		public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, void* lParam);
		#endregion
		#region SetWindowLong
		[DllImport("User32", SetLastError = true)]
		public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, int dwNewLong);
		[DllImport("User32", SetLastError = true)]
		public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, WS dwNewLong);
		[DllImport("User32", SetLastError = true)]
		public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, WS_EX dwNewLong);
		[DllImport("User32", SetLastError = true)]
		public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, IntPtr dwNewLong);
		#endregion
		#region UnregisterDeviceNotification
		[DllImport("User32", SetLastError = true)]
		public static extern bool UnregisterDeviceNotification(IntPtr Handle);
		#endregion
	}
}
